home *** CD-ROM | disk | FTP | other *** search
- └ w O└The soundex algorithm was established to provide a simple way to get a 'sounds
- like' comparison between two character strings. Lately I have heard several
- arguments on the CIS NANFORUM that the clipper soundex() function in the
- extended library does not return a code according to the way that it should.
-
- Figure 3 merely demonstrates the difference between the three methods of the
- soundex.
-
- The algorithm quoted in the header of the soundex function in the file
- examplec.c states that:
-
- The first character of the string is used as is, without converting to
- a number.
-
- All of the vowels as well as the soft consonants shall be discarded.
- These are "AEHIOUWY". Also, all numbers and puncuation will be
- discarded.
-
- The other consonants will be given values of one through six, as
- follows:
-
- 1 = "BFPV"
- 2 = "CGJKQSXZ"
- 3 = "DT"
- 4 = "L"
- 5 = "MN"
- 6 = "R"
-
- If there are double consonants, the second one is discarded.
-
- The code is padded with trailing zeroes if there are not sufficient
- characters to complete the four character soundex code.
-
- Based on this, the clipper function performs exactly as it should. If we were
- to write a soundex function in clipper (which we can, but we sacrifice some
- speed) the code might look like figure 1. If we were to rewrite the code in C,
- it might look like the code in figure 2. By the way, the code in soundx2.c
- performs approximately 45% faster than the one in examplec.c, it strips the
- unwanted characters from the input string before producing the soundex code and
- it does not have the side benefit of capitalizing the original input string.
-
- Figure 3 is merely a test program designed to demonstrate the three different
- soundex functions.
-
- The soundex algorithm has been around for some time, I first stumbled onto it
- several years ago and have used it extensively in name look up over the years.
- It can be depended upon to find something that sounds like whatever has been
- given to it to look for.